﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Modulos/ModuloPrestamo/VistaControl/MasterPagePrestamo.master" AutoEventWireup="true" CodeFile="adminPrestamos.aspx.cs" Inherits="Modulos_ModuloPrestamo_VistaControl_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
Módulo de Préstamos - Administracion de préstamos
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <h2>Administración de Cartas de prestamo</h2><br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="CARTA_ID" DataSourceID="SqlDataSource1" 
        EmptyDataText="No hay registros de datos para mostrar." AllowPaging="True" 
        AllowSorting="True">
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        OnClientClick="javascript:if(!confirm('&iquest;Confirma actualizar carta?'))return false" 
                        CommandName="Update" Text="Actualizar"></asp:LinkButton>
                    <br /><asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancelar"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Editar"></asp:LinkButton>
                    <br /><asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Select" Text="Seleccionar"></asp:LinkButton>
                    <br /><asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" 
                        OnClientClick="javascript:if(!confirm('&iquest;Confirma eliminar préstamo?'))return false" 
                        CommandName="Delete" Text="Eliminar"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CARTA_ID" HeaderText="Id" ReadOnly="True" 
                SortExpression="CARTA_ID" />
            <asp:TemplateField HeaderText="Usuario" SortExpression="USR_RUT">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" 
                        DataSourceID="SqlDataSourceUsr1" DataTextField="USR_RUT"
                        SelectedValue='<%# Bind("USR_RUT") %>'
                        DataValueField="USR_RUT">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceUsr1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [USR_RUT] FROM [USUARIO]">
                    </asp:SqlDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("USR_RUT") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Lug. Entrega" SortExpression="LUG_ID">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" 
                        DataSourceID="SqlDataSourceLEntrega" DataTextField="NOMBRE_LUG" 
                        SelectedValue='<%# Bind("LUG_ID") %>'
                        DataValueField="LUG_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceLEntrega" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [NOMBRE_LUG], [LUG_ID] FROM [LUGAR_ENTREGA_DEVOLUCION]">
                    </asp:SqlDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownListasd" runat="server" 
                        DataSourceID="SqlDataSourceLEntregagyu" DataTextField="NOMBRE_LUG" 
                        SelectedValue='<%# Bind("LUG_ID") %>'
                        Enabled="false"
                        DataValueField="LUG_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceLEntregagyu" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [NOMBRE_LUG], [LUG_ID] FROM [LUGAR_ENTREGA_DEVOLUCION]">
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Lug. Dev." SortExpression="LUG_LUG_ID">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownListDEV" runat="server" 
                        DataSourceID="SqlDataSourceLDev" DataTextField="NOMBRE_LUG" 
                        SelectedValue='<%# Bind("LUG_LUG_ID") %>'
                        DataValueField="LUG_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceLDev" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [NOMBRE_LUG], [LUG_ID] FROM [LUGAR_ENTREGA_DEVOLUCION]">
                    </asp:SqlDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownListDEV1" runat="server" 
                        DataSourceID="SqlDataSourceLDev1" DataTextField="NOMBRE_LUG" 
                        SelectedValue='<%# Bind("LUG_LUG_ID") %>'
                        Enabled="false"
                        DataValueField="LUG_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceLDev1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [NOMBRE_LUG], [LUG_ID] FROM [LUGAR_ENTREGA_DEVOLUCION]">
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Beneficiario" SortExpression="RUT_BEN">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList3" runat="server" 
                        DataSourceID="SqlDataSourcebene" DataTextField="RUT_BEN" 
                        SelectedValue='<%# Bind("RUT_BEN") %>'
                        DataValueField="RUT_BEN">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourcebene" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [RUT_BEN] FROM [BENEFICIARIO]"></asp:SqlDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("RUT_BEN") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Fecha inicio" SortExpression="FECHA_INI_CARTA">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("FECHA_INI_CARTA") %>'></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="TextBox5" Display="Dynamic" 
                        ErrorMessage="* formato: 01/01/01 00:00:00" 
                        ValidationExpression="\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}"></asp:RegularExpressionValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("FECHA_INI_CARTA") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Fecha fin" SortExpression="FECHA_FIN_CARTA">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("FECHA_FIN_CARTA") %>'></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="TextBox6" Display="Dynamic" 
                        ErrorMessage="* formato: 01/01/01 00:00:00" 
                        ValidationExpression="\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}"></asp:RegularExpressionValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("FECHA_FIN_CARTA") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Comentario" SortExpression="COMENTARIO_CARTA">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" 
                        Text='<%# Bind("COMENTARIO_CARTA") %>' TextMode="MultiLine"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("COMENTARIO_CARTA") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
        DeleteCommand="DELETE FROM [CARTA_PRESTAMO] WHERE [CARTA_ID] = @CARTA_ID" 
        InsertCommand="INSERT INTO [CARTA_PRESTAMO] ([USR_RUT], [LUG_ID], [USU_USR_RUT], [LUG_LUG_ID], [RUT_BEN], [FECHA_INI_CARTA], [FECHA_FIN_CARTA], [COMENTARIO_CARTA]) VALUES (@USR_RUT, @LUG_ID, @USU_USR_RUT, @LUG_LUG_ID, @RUT_BEN, @FECHA_INI_CARTA, @FECHA_FIN_CARTA, @COMENTARIO_CARTA)" 
        ProviderName="<%$ ConnectionStrings:AppCeiiConnectionString.ProviderName %>" 
        SelectCommand="SELECT [CARTA_ID], [USR_RUT], [LUG_ID], [USU_USR_RUT], [LUG_LUG_ID], [RUT_BEN], [FECHA_INI_CARTA], [FECHA_FIN_CARTA], [COMENTARIO_CARTA] FROM [CARTA_PRESTAMO] WHERE ([USU_USR_RUT] &lt;&gt; @USU_USR_RUT)" 
        
        UpdateCommand="UPDATE [CARTA_PRESTAMO] SET [USR_RUT] = @USR_RUT, [LUG_ID] = @LUG_ID, [USU_USR_RUT] = @USU_USR_RUT, [LUG_LUG_ID] = @LUG_LUG_ID, [RUT_BEN] = @RUT_BEN, [FECHA_INI_CARTA] = @FECHA_INI_CARTA, [FECHA_FIN_CARTA] = @FECHA_FIN_CARTA, [COMENTARIO_CARTA] = @COMENTARIO_CARTA WHERE [CARTA_ID] = @CARTA_ID">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="USU_USR_RUT" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="CARTA_ID" Type="Decimal" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="USR_RUT" Type="Int32" />
            <asp:Parameter Name="LUG_ID" Type="Decimal" />
            <asp:Parameter Name="USU_USR_RUT" Type="Int32" />
            <asp:Parameter Name="LUG_LUG_ID" Type="Decimal" />
            <asp:Parameter Name="RUT_BEN" Type="Int32" />
            <asp:Parameter Name="FECHA_INI_CARTA" Type="DateTime" />
            <asp:Parameter Name="FECHA_FIN_CARTA" Type="DateTime" />
            <asp:Parameter Name="COMENTARIO_CARTA" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="USR_RUT" Type="Int32" />
            <asp:Parameter Name="LUG_ID" Type="Decimal" />
            <asp:Parameter Name="USU_USR_RUT" Type="Int32" />
            <asp:Parameter Name="LUG_LUG_ID" Type="Decimal" />
            <asp:Parameter Name="RUT_BEN" Type="Int32" />
            <asp:Parameter Name="FECHA_INI_CARTA" Type="DateTime" />
            <asp:Parameter Name="FECHA_FIN_CARTA" Type="DateTime" />
            <asp:Parameter Name="COMENTARIO_CARTA" Type="String" />
            <asp:Parameter Name="CARTA_ID" Type="Decimal" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
    Seleccione una carta
    <asp:Button ID="ButtonvistaPrevia" runat="server" onclick="verVistaPrevia" 
        Text="Vista Previa" />
    <br />
    Modificar cantidades de material:<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:AppCeiiConnectionString.ProviderName %>"
        DeleteCommand="DELETE FROM LISTA_MATERIAL_PRESTAMO WHERE (MAT_P_ID = @MAT_P_ID) AND (CARTA_ID = @CARTA_ID)" 
        InsertCommand="INSERT INTO LISTA_MATERIAL_PRESTAMO(MAT_P_ID, CARTA_ID, CANT_MAT_P) VALUES (@MAT_P_ID, @CARTA_ID, @CANT_MAT_P)"  
        SelectCommand="SELECT LISTA_MATERIAL_PRESTAMO.MAT_P_ID, LISTA_MATERIAL_PRESTAMO.CARTA_ID, LISTA_MATERIAL_PRESTAMO.CANT_MAT_P FROM LISTA_MATERIAL_PRESTAMO INNER JOIN CARTA_PRESTAMO ON LISTA_MATERIAL_PRESTAMO.CARTA_ID = CARTA_PRESTAMO.CARTA_ID WHERE (LISTA_MATERIAL_PRESTAMO.CARTA_ID = @CARTA_ID) AND (CARTA_PRESTAMO.USU_USR_RUT &lt;&gt; '0')"  
        
        UpdateCommand="UPDATE LISTA_MATERIAL_PRESTAMO SET CANT_MAT_P = @CANT_MAT_P WHERE (MAT_P_ID = @MAT_P_ID) AND (CARTA_ID = @CARTA_ID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="CARTA_ID" 
                PropertyName="SelectedValue" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="MAT_P_ID" Type="Decimal"/>
            <asp:Parameter Name="CARTA_ID" Type="Decimal"/>
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CANT_MAT_P" />
            <asp:Parameter Name="MAT_P_ID" />
            <asp:Parameter Name="CARTA_ID" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="MAT_P_ID" />
            <asp:Parameter Name="CARTA_ID" />
            <asp:Parameter Name="CANT_MAT_P" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource2">
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="True" 
                    OnClientClick="javascript:if(!confirm('&iquest;Confirma modificar cantidad?'))return false"
                        CommandName="Update" Text="Actualizar"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancelar"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton6" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Editar"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="No. Carta" SortExpression="CARTA_ID">
                <EditItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("CARTA_ID") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%# Bind("CARTA_ID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Material" SortExpression="MAT_P_ID">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList7" runat="server" 
                        DataSourceID="SqlDataSourceBBB" DataTextField="NOMBRE_MAT_P" 
                        SelectedValue='<%# Bind("MAT_P_ID") %>'
                        Enabled="false"
                        DataValueField="MAT_P_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceBBB" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [MAT_P_ID], [NOMBRE_MAT_P] FROM [MATERIAL_PRESTAMO]">
                    </asp:SqlDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownList6" runat="server" 
                        DataSourceID="SqlDataSourceAAA" DataTextField="NOMBRE_MAT_P" 
                        SelectedValue='<%# Bind("MAT_P_ID") %>'
                        Enabled="false"
                        DataValueField="MAT_P_ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceAAA" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                        SelectCommand="SELECT [MAT_P_ID], [NOMBRE_MAT_P] FROM [MATERIAL_PRESTAMO]">
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Cantidad" SortExpression="CANT_MAT_P">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Height="20px" 
                        Text='<%# Bind("CANT_MAT_P") %>' Width="26px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox3" Display="Dynamic" 
                        ErrorMessage="* campo obligatorio"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                        ControlToValidate="TextBox3" Display="Dynamic" ErrorMessage="* campo numérico" 
                        ValidationExpression="\d*"></asp:RegularExpressionValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("CANT_MAT_P") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    Agregar materiales a una carta:<br />
    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource2">
        <InsertItemTemplate>
            <table style="width: 100%">
                <tr>
                    <td colspan="2">
                        Ingresar material a préstamo</td>
                </tr>
                <tr>
                    <td>
                        No. Carta:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList4" runat="server" 
                            DataSourceID="SqlDataSource1" DataTextField="CARTA_ID" 
                            SelectedValue='<%# Bind("CARTA_ID") %>'
                            DataValueField="CARTA_ID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        Material:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList5" runat="server" 
                            DataSourceID="SqlDataSourceMat123" DataTextField="NOMBRE_MAT_P" 
                            SelectedValue='<%# Bind("MAT_P_ID") %>'
                            DataValueField="MAT_P_ID">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSourceMat123" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
                            SelectCommand="SELECT [MAT_P_ID], [NOMBRE_MAT_P] FROM [MATERIAL_PRESTAMO]">
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td>
                        Cantidad:</td>
                    <td>
                        <asp:TextBox ID="CANT_MAT_PTextBox" runat="server" 
                            Text='<%# Bind("CANT_MAT_P") %>' />
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                            ControlToValidate="CANT_MAT_PTextBox" Display="Dynamic" 
                            ErrorMessage="* campo numérico" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="CANT_MAT_PTextBox" Display="Dynamic" 
                            ErrorMessage="* campo obligatorio"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                        OnClientClick="javascript:if(!confirm('&iquest;Confirma insertar material en carta préstamo?'))return false" 
                            CommandName="Insert" Text="Insertar" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
                    </td>
                </tr>
            </table>
        </InsertItemTemplate>
        <ItemTemplate>
            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Ingresar material a un préstamo" />
        </ItemTemplate>
        <EmptyDataTemplate>
            <asp:LinkButton ID="NewButton0" runat="server" CausesValidation="False" 
                CommandName="New" Text="Ingresar material a un préstamo" />
        </EmptyDataTemplate>
    </asp:FormView>
    <br />
    <br />
    Eliminar materiales existentes en carta de prestamo: <br />
    <asp:DropDownList ID="DropDownListNoCarta" runat="server" 
        DataSourceID="SqlDataSource3" DataTextField="CARTA_ID" 
        DataValueField="CARTA_ID">
    </asp:DropDownList>
    
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
        
        SelectCommand="SELECT [CARTA_ID] FROM [CARTA_PRESTAMO] WHERE ([USU_USR_RUT] &lt;&gt; @USU_USR_RUT)">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="USU_USR_RUT" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:DropDownList ID="DropDownListMatID" runat="server" 
        DataSourceID="SqlDataSource4" DataTextField="NOMBRE_MAT_P" 
        DataValueField="MAT_P_ID">
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AppCeiiConnectionString %>" 
        SelectCommand="SELECT LISTA_MATERIAL_PRESTAMO.MAT_P_ID, MATERIAL_PRESTAMO.NOMBRE_MAT_P, LISTA_MATERIAL_PRESTAMO.CANT_MAT_P FROM LISTA_MATERIAL_PRESTAMO INNER JOIN MATERIAL_PRESTAMO ON LISTA_MATERIAL_PRESTAMO.MAT_P_ID = MATERIAL_PRESTAMO.MAT_P_ID WHERE (LISTA_MATERIAL_PRESTAMO.CARTA_ID = @id_carta)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownListNoCarta" Name="id_carta" 
                PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
    &nbsp;
    <asp:LinkButton ID="LinkButtonEliminar" runat="server" onclick="eliminar">eliminar</asp:LinkButton>&nbsp;
    <asp:Label ID="LabelERROR" runat="server" Text="error" Visible="False" ForeColor="Red"></asp:Label>
</asp:Content>

